package com.mtsmda.jpa.run;

import java.util.Date;

import com.mtsmda.jpa.dao.BookDAOI;
import com.mtsmda.jpa.dao.CarDAOI;
import com.mtsmda.jpa.dao.impl.BookDAO;
import com.mtsmda.jpa.dao.impl.CarDAO;
import com.mtsmda.jpa.domain.Author;
import com.mtsmda.jpa.domain.Book;
import com.mtsmda.jpa.domain.Car;

public class RunTest {

	public static void main(String[] args) {
		CarDAOI carDAOI = new CarDAO();
		System.out.println(carDAOI.deleteAllCars());
		// System.out.println(carDAOI.truncateCars());
		Car car = new Car("BMW X5", new Date(), new Float(25000));
		Car carVaz2107 = new Car("Vaz 2107", new Date(), new Float(7000));
		Car carSmart = new Car("Smart", new Date(), new Float(5900));
		Car carMitsubisiEvolutionX = new Car("Mitsubisi Evolution X",
				new Date(), new Float(25000));
		Car carBWMX6 = new Car("BMW X6", new Date(), new Float(25000));
		System.out.println(carDAOI.addCar(car));
		System.out.println(carDAOI.addCar(carVaz2107));
		System.out.println(carDAOI.addCar(carSmart));
		System.out.println(carDAOI.addCar(carMitsubisiEvolutionX));
		System.out.println(carDAOI.addCar(carBWMX6));

		System.out.println("*** *** ***");
		
//		Author author = new Author();
//		author.setFirstnameAuthor("Pushkin");
//		author.setLastnameAuthor("Alexandr");
//		
//		Book book = new Book();
//		book.setNameBook("U lukomoriya ... ");
//		book.getAuthors().add(author);
//		
//		author.getBooks().add(book);
//		
//		AuthorDAOI authorDAOI = new AuthorDAO();
//		System.out.println(authorDAOI.addAuthor(author));
		
		System.out.println("*** *** ***");
		
		Author author2 = new Author("Turgenev", "Ivan");
		Book book2 = new Book("Kniga Turgeneva");
		book2.getAuthors().add(author2);
		author2.getBooks().add(book2);
		
		BookDAOI bookDAOI = new BookDAO();
		bookDAOI.addBook(book2);
		
	}

}